﻿$(function () {
    var c = 0;
});

var DevelopOkFunc = function () {
    var keyid = request("keyid");
    if (keyid == "") return false;
    var ajaxUrl = "/RequireBug/Bug/BugStageChange";

    var me = window.confirm("确定要执行[开发完毕]操作？");
    if (me == true) {
        $.AjaxEvent({
            url: ajaxUrl,
            data: JSON.stringify({ StageTitle: "Testing", RequireID: keyid }),
            type: "post",
            success: function (data) {
                if (data.Code <= 0) {
                    alert("操作失败,请重试!");
                    return false;
                }
                else {
                    //alert("保存成功!");
                    window.location.href = "/RequireBug/Bug/Index";
                }
            }
        });
    }
}

var TestOkFunc = function () {
    var keyid = request("keyid");
    if (keyid == "") return false;
    var ajaxUrl = "/RequireBug/Bug/BugStageChange";
    var me = window.confirm("确定要执行[测试完毕]操作？");
    if (me == true) {
        $.AjaxEvent({
            url: ajaxUrl,
            data: JSON.stringify({ StageTitle: "Accepting", RequireID: keyid }),
            type: "post",
            success: function (data) {
                if (data.Code <= 0) {
                    alert("操作失败,请重试!");
                    return false;
                }
                else {
                    //alert("保存成功!");
                    window.location.href = "/RequireBug/Bug/Index";
                }
            }
        });
    }
}

var DevelopAgainFunc = function () {
    var keyid = request("keyid");
    if (keyid == "") return false;
    var ajaxUrl = "/RequireBug/Bug/BugStageChange";
    var me = window.confirm("确定要执行[重新开发]操作？");
    if (me == true) {
        $.AjaxEvent({
            url: ajaxUrl,
            data: JSON.stringify({ StageTitle: "Developing", RequireID: keyid }),
            type: "post",
            success: function (data) {
                if (data.Code <= 0) {
                    alert("操作失败,请重试!");
                    return false;
                }
                else {
                    //alert("保存成功!");
                    window.location.href = "/RequireBug/Bug/Index";
                }
            }
        });
    }
}

var AcceptOkFunc = function () {
    var keyid = request("keyid");
    if (keyid == "") return false;
    var ajaxUrl = "/RequireBug/Bug/BugStageChange";
    var me = window.confirm("确定要执行[验收结束]操作？");
    if (me == true) {
        $.AjaxEvent({
            url: ajaxUrl,
            data: JSON.stringify({ StageTitle: "Finish", RequireID: keyid }),
            type: "post",
            success: function (data) {
                if (data.Code <= 0) {
                    alert("操作失败,请重试!");
                    return false;
                }
                else {
                    //alert("保存成功!");
                    window.location.href = "/RequireBug/Bug/Index";
                }
            }
        });
    }
}

var DeleteOkFunc = function () {
    var keyid = request("keyid");
    if (keyid == "") return false;
    var ajaxUrl = "/RequireBug/Bug/Delete";

    var me = window.confirm("确定要执行[删除]操作？");
    if (me == true) {
        $.AjaxEvent({
            url: ajaxUrl,
            data: JSON.stringify({ UserID: 0, RequireID: keyid }),
            type: "post",
            success: function (data) {
                if (data.Code <= 0) {
                    alert("操作失败,请重试!");
                    return false;
                }
                else {
                    //alert("保存成功!");
                    window.location.href = "/RequireBug/Bug/Index";
                }
            }
        });
    }
}

var GoToEdit = function () {
    var keyid = request("keyid");
    if (keyid == "") return false;
    window.location.href = "/RequireBug/Bug/Edit?keyid=" + keyid;
}